<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.util.*"
    pageEncoding="UTF-8"%>
    <%
     String path = request.getContextPath();
    %>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="res/css/amazeui.min.css" />
		<link rel="stylesheet" href="res/css/admin.css" />
		<style type="text/css">
		img{width:100px;height:100px}
		table{padding: 10px;margin:10px;}
		</style>
		
			<script src="js/jquery-1.11.3.min.js"></script>
		<!--<![endif]-->
		<script type="text/javascript" src="myplugs/js/plugs.js"></script>
	</head>
	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">导游团管理</strong><small></small></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<button type="button"   id="newpack"  class="am-btn am-btn-default"><span class="am-icon-plus"></span> 添加导游团</button>
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-3">

				</div>
				<div class="am-u-sm-12 am-u-md-3">
					<div class="am-input-group am-input-group-sm">
						<input type="text" class="am-form-field">
						<span class="am-input-group-btn">
            <input class="am-btn am-btn-default" type="button"  value="搜索">
          </span>
					</div>
				</div>
			</div>
	 <jsp:include page="/PackageTourServlet"><jsp:param value="showAllPackageTour" name="method"/></jsp:include>
           <%
           ArrayList<PackageTour> pat  = (ArrayList<PackageTour>)request.getAttribute("pat");
           Pager pager = (Pager) request.getAttribute("pager");
           %>
           <table>
           <tr><td>导游团图片</td>
           		<td>导游团名</td>
           		<td>导游团简介</td>
           		<td>导游团人数</td>
           		<td>导游团价格</td>
           		<td>导游团时间</td>
           		<td>操作</td>
           </tr>
            <%for(PackageTour p:pat){ %>
                 <tr><td><img src="<%=path%>/packageImage/<%=p.getPhoto()%>"></td>
                     <td><%=p.getTitle() %></td>
                     <td><%=p.getInfomation() %></td>
           			 <td><%=p.getPeople() %></td>
           			 <td><%=p.getPrice() %></td>
           			 <td><%=p.getPacktime() %></td>
           			 <td><input type="button" cid=<%=p.getId() %> id="modify" value="修改"><input type="button" id="delete" cid=<%=p.getId() %> value="删除"></td></tr>
            <%} %>
           </table> 
          
           
           <!-- 显示页码 -->
           <div class="pager">
           <%
           for(int i=1;i<=pager.getPageCount();i++)
           {%>
              <a href="<%=path%>/index/packagetour.jsp?pageNum=<%=i%>" class=<%=(i==pager.getPageNum()?"cur":"")%>><%=i%></a>
           
           <%}%>
                          共<%=pager.getPageCount() %>页   共<span id="HowManyData"><%=pager.getDataCount() %></span>记录
           </div>
	<script type="text/javascript">
	  $(document).ready(function(){
		  $("input[id=delete]").click(function(){
			  var id = $(this).attr("cid");
			  var thiss = $(this);
			  $.ajax({
				  url:"<%=path %>/PackageTourServlet",
				  type:"post",
				  data:"method=dele&id="+id,
				  success:function(mes){
					  thiss.parent().parent().remove();
					  $("#HowManyData").html(<%=pager.getDataCount() %>-1);
				  }
			  });
		  });
	  });
	</script>
			<div class="am-g">
				<div class="am-u-sm-12">
					 <script >
					 $("#newpack").click(function() {
							
							$.jq_Panel({
								title: "添加导游团",
								iframeWidth: 600,
								iframeHeight: 400,
								url: "addpack.jsp"
							});
						});
					 
					 </script>
					 <script>
					 $("input[id=modify]").click(function() {
							var cid = $(this).attr("cid");
							$.jq_Panel({
								title: "修改导游团",
								iframeWidth: 600,
								iframeHeight: 400,
								url: "mopack.jsp?id="+cid,
							});
						});
					 </script>
				</div>
			</div>
		</div>
	</body>
</html>